package tedu.study.ooday05_2;

public class Point {
    private int x;
    private int y;

    public int getX(){
        return x;
    }
    //在set中做数据合法性验证
    public void setX(int x){
        if(x>=0){
            this.x = x;
        }
    }

    //选择性存在,注释其中一个方法
    //设置为只读
    public int getY(){
        return y;
    }
    public void setY(int y){
        this.y = y;
    }

}
